<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://shiro.apache.org/tags" %>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<%@ include file="../../jQgrid.jsp"%>
	
	<link type="text/css" rel="stylesheet" href="<%=contextPath %>/plugins/zTree/2.6/zTreeStyle.css"/>
	<script type="text/javascript" src="<%=contextPath %>/plugins/zTree/2.6/jquery.ztree-2.6.min.js"></script>
</head>
<body >
<div class="" >
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox " style="margin-bottom: 0px;">
				<div class="ibox-title" style="border-color: white;">
					<div class="row">
						<div class="col-sm-3">
							<div class="input-group">
								<input id="name" type="text" placeholder="请输入关键词" class="input-sm form-control"> <span class="input-group-btn">
                                        <a id="find_btn" type="button" class="btn btn-sm btn-primary"> 搜索</a> </span>
							</div>
						</div>
					</div>
				</div>
				<div class="ibox-content">

					<div class="jqGrid_wrapper">
						<table id="table_list"></table>
						<div id="pager_list"></div>
					</div>

				</div>
			</div>
		</div>
	</div>
</div>
<!-- Page-Level Scripts -->
<script>
    $(document).ready(function() {
        $.jgrid.defaults.styleUI = "Bootstrap";
        $("#table_list").jqGrid({
            url: '<%=contextPath %>/app/listData',
            data : {},
            datatype : "json",
            autowidth : true,
            shrinkToFit : true,
            mtype : "post",
            rowNum : 20,
            rowList : [ 10, 20, 30 ],
            colNames: ["id", "apk名称", "版本", "版本号", "版本描述", "apk路径", "修改时间", "备注说明","操作"],
            colModel: [{
                name: "id",
                index: "id",
                hidden: true
            }, {
                name: "name",
                index: "name",
                width: 30
            }, {
                name: "versionCode",
                index: "versionCode",
                width: 20
            }, {
                name: "versionName",
                index: "versionName",
                width: 20
            }, {
                name: "description",
                index: "description",
                width: 70
            }, {
                name: "path",
                index: "path",
                width: 50

            }, {
                name: "updatatime",
                index: "updatatime",
                width: 50
            }, {
                name: "remarks",
                index: "remarks",
                width: 90
            },{
                formatter:function(cellvalue, options, row){
                    return "<s:hasPermission name="app:updateview"><a class='btn btn-small btn-info' title='查看' onclick='showdetail("+row.id+")'><i class='icon-eye-open'></i></a></s:hasPermission>";
                },
                width : 30
            }],
            height : $(window).height() - 170,
            pager : "#pager_list",
            viewrecords : true,
            hidegrid : false
        });

        //表格自适应高宽
        $(window).bind("resize", function() {
            var b = $(".jqGrid_wrapper").width();
            $("#table_list").setGridWidth(b);
            $("#table_list").setGridHeight($(window).height() - 170);
        })

        $("#table_list")
            .navGrid('#pager_list',{edit:false,add:false,del:false,search:false})
        $("#find_btn").click(function(){
            var name = $("#name").val();
            $("#table_list").jqGrid('setGridParam',{
                postData:{'name':name}, //发送数据
                page:1
            }).trigger("reloadGrid"); //重新载入
        });

    });
    function showdetail(id){
        openyem("更新版本","<%=contextPath %>/app/updateView?id="+id,550,850);//查看页面
    }
</script>

</body>
</html>

